﻿
$(document).bind('dds.window.init', function (e, win) {
    $.page.init();
});
function Page() {
    var isInHost = false;
    this.init = function () {
        var self = this;
        isInHost = dds.window.check();
        $(document).bind('keydown', function (e) {
            if (e.keyCode == 115) {
                $('img[src="images/quit.png"]').parent().parent().click();
            }
        });
        $('img[src="images/quit.png"]').parent().parent().bind("click", function () {
                
            self.logout();
            return false;
        });
        $('img[src="images/fresh.png"]').parent().parent().bind('click', function (e) {

            self.refresh();
            return false;
        });
    }

    this.refresh = function () {
        if (isInHost) {
            _host.refresh();
        } else {
            document.location.reload();
        }
    }
    this.logout = function () {
        if (isInHost) {
            var html = '<a onclick="_host.exit();"  class="bg-blue"><img src="images/exit.svg" />退出</a><a onclick="_host.shutdown();"  class="bg-red"><img src="images/shutdown.svg" />关机</a>';
            $.showMsg(html);

        } else {
            $.confirm("确定退出吗？", function () {
            }, function () { return false; });
        }
    }
    this.logoff = function () {
        location.href = "index.html";
    }
}
$.page = new Page();